#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
int* sumZero(int n, int* returnSize)
{
    *returnSize = n;
    if (n == 0)
    {
        return NULL;
    }
    int* ans = (int*)malloc(sizeof(int) * n);
    int k = 0, m = 1;
    if (n % 2 == 0)
    {
        while (n)
        {
            ans[k++] = m;
            ans[k++] = -m;
            m++;
            n -= 2;
        }
    }
    else
    {
        ans[k++] = 0;
        n--;
        while (n != 0)
        {
            if (n != 0)
            {
                ans[k++] = m;
                n--;
            }
            if (n != 0)
            {
                ans[k++] = -m;
                n--;
            }
            m++;
        }
    }
    return ans;
}
int main()
{
    int n = 5;
    int sz = 0;
    int* ans = sumZero(n, &sz);
    for (int i = 0; i < sz; i++)
    {
        printf("%d ", ans[i]);
    }
    return 0;
}